<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>支付二维码</title>

</head>
<body>

	支付总金额  0.01元
	 <span id="myspan"></span>
	 <input id="out_trade_no" value="${out_trade_no }"></input>
	<div id="output">
	
	</div>



	<script
		src="http://127.0.0.1:8080/wxPay/resources/jquery-1.10.2.min.js"></script>

	<script type="text/javascript"
		src="http://127.0.0.1:8080/wxPay/resources/jquery.qrcode.min.js"></script>

	<script>
		jQuery(function() {

			jQuery('#output').qrcode("${code_url}");

		})

		$(document).ready(function() {
			setInterval("ajaxstatus()", 6000);
		});

		function ajaxstatus() {
			if ($("#out_trade_no").val() != 0) {
				$.ajax({
					url : "orderQuery?out_trade_no=" + $("#out_trade_no").val(),
					type : "GET",
					dataType : "json",
					data : "",
					success : function(data) {
						// 	            	alert(data);
						if (data == 1) { //订单状态为1表示支付成功
							window.location.href = "http://127.0.0.1:8080/wxPay/paysuccess.jsp"; //页面跳转
							alert("支付成功");
						}
					},
					error : function() {
						//alert("请求订单状态出错");
						$('myspan').html('<span style="color:#0C9;">支付未完成</span>');
					}
				});
			}

		}
	</script>





</body>
</html>